﻿//***********************************************************************
// Assembly         : NMortgage.UI
// Author           : Mike
// Created          : 04-29-2012
//
// Last Modified By : Mike
// Last Modified On : 04-30-2012
// Description      : 
//
// Copyright        : (c) . All rights reserved.
//***********************************************************************
using System.Globalization;
namespace NMortgage.UI.Model
{
    using System.Collections.Generic;

    public sealed class Fee : ABaseValidatedType<Fee, FeeValidator>
    {
        #region Fields

        private const int MONTHS_IN_YEAR = 12;

        private double amount;
        private int months;
        private int years;

        #endregion Fields

        #region Constructors

        public Fee()
        {
        }

        #endregion Constructors

        #region Properties

        public double Amount
        {
            get
            {
                return amount;
            }
            set
            {
                amount = value;
                NotifyOfPropertyChange(()=>Amount);
            }
        }

        public string Description
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture, Properties.Resources.FeeDescriptionFormat,
                    Amount, TotalDurationInMonths, Properties.Resources.MonthsLabel);
            }
        }

        public int Months
        {
            get
            {
                return months;
            }
            set
            {
                months = value;
                NotifyOfPropertyChange(() => Years);
                NotifyOfPropertyChange(() => Months);
            }
        }

        public int TotalDurationInMonths
        {
            get { return (Years * MONTHS_IN_YEAR) + Months; }
        }

        public int Years
        {
            get
            {
                return years;
            }
            set
            {
                years = value;
                NotifyOfPropertyChange(() => Years);
                NotifyOfPropertyChange(() => Months);
            }
        }

        #endregion Properties
    }
}